package com.wasion.pwportable.jsi;

import java.io.File;

import android.os.Environment;
import jxl.format.Alignment;
import jxl.format.Colour;
import jxl.format.UnderlineStyle;
import jxl.format.VerticalAlignment;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;

/**
 * 
 * @ClassName: Export
 * @Description: 数据导出共用信息
 * @author 高意
 * @date 2014-9-26 下午2:36:38
 * 
 */
public class Export {
	// 表名样式
	private static WritableCellFormat CELL_FORMAT_TITLE;

	// 表头样式
	private static WritableCellFormat CELL_FORMAT_HEADER;

	// 表体样式
	private static WritableCellFormat CELL_FORM_BODY;
	
	// U盘路径
	private static final String U_DISK_PATH = "/mnt/usbotg";

	public static WritableCellFormat getTitleCellFormat() {
		try {
			WritableFont titleFont = new WritableFont(
					WritableFont.createFont("黑体"), 16, WritableFont.BOLD,
					false, UnderlineStyle.NO_UNDERLINE, Colour.ORANGE);

			CELL_FORMAT_TITLE = new WritableCellFormat(titleFont);
			CELL_FORMAT_TITLE.setVerticalAlignment(VerticalAlignment.CENTRE);
			CELL_FORMAT_TITLE.setAlignment(Alignment.CENTRE);
			CELL_FORMAT_TITLE.setBackground(Colour.YELLOW);

		} catch (Exception e) {
		}

		return CELL_FORMAT_TITLE;
	}

	public static WritableCellFormat getHeaderCellFormat() {
		try {

			// 表头样式
			WritableFont headerFont = new WritableFont(
					WritableFont.createFont("黑体"), 14, WritableFont.NO_BOLD,
					false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);

			CELL_FORMAT_HEADER = new WritableCellFormat(headerFont);
			CELL_FORMAT_HEADER.setVerticalAlignment(VerticalAlignment.CENTRE);
			CELL_FORMAT_HEADER.setAlignment(Alignment.CENTRE);
			CELL_FORMAT_HEADER.setBackground(Colour.ORANGE);

		} catch (Exception e) {
		}

		return CELL_FORMAT_HEADER;
	}

	public static WritableCellFormat getBodyCellFormat() {
		try {

			// 表体样式
			WritableFont bodyFont = new WritableFont(
					WritableFont.createFont("宋体"), 12, WritableFont.NO_BOLD,
					false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);

			CELL_FORM_BODY = new WritableCellFormat(bodyFont);
			CELL_FORM_BODY.setVerticalAlignment(VerticalAlignment.CENTRE);
			CELL_FORM_BODY.setAlignment(Alignment.LEFT);
		} catch (Exception e) {
		}

		return CELL_FORM_BODY;
	}

	/**
	 * 
	 * @Title: getSDPath
	 * @Description: 获取SD卡路径
	 * @param
	 * @return
	 * @throws
	 */
	public static String getSDPath() {
		File sdDir = null;
		boolean sdCardExist = Environment.getExternalStorageState().equals(
				android.os.Environment.MEDIA_MOUNTED); // 判断sd卡是否存在
		if (sdCardExist) {
			sdDir = Environment.getExternalStorageDirectory();// 获取跟目录
		}
		return sdDir.getPath();
	}

	/**
	 * 
	* @Title: getUDiskPath 
	* @Description: 获取U盘路径
	* @param 
	* @return 
	* @throws
	 */
	public static String getUDiskPath() {

		return U_DISK_PATH;
	}
}
